﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace 桌面视频录制
{
    [Serializable]
    public class DrawPolygonWithFill : DrawPolygon
    {
        public DrawPolygonWithFill(Point startPoint)
            : base(startPoint) { }
        public override void Draw(Graphics g)
        {
            if (startDrawPolygon == false)
            {
                if (pointList.Count > 1)
                {
                    Pen pen = new Pen(this.PenColor);
                    pen.Width = this.PenWidth;
                    g.DrawLines(pen, pointList.ToArray());
                    pen.Dispose();
                }
            }
            else
            {
                Brush brush = DrawBrush.GetBrush();
                g.FillPolygon(brush, pointList.ToArray());
                brush.Dispose();
            }
        }
        public override string ToString()
        {
            string printMsg = "[实多(" + this.pointList[0].X + "," + this.pointList[0].Y + ")]->[ID:" + this.Id + "]";
            return printMsg;
        }
        public override string GetDrawObjectMsg()
        {
            string drawObjectMsg = "实多->起始位置(" + this.pointList[0].X + "," + this.pointList[0].Y + "),边数:" + this.pointList.Count + "条";
            return drawObjectMsg;
        }
    }
}
